package lormi.meipin.service.impl;


import java.util.List;

import org.springframework.stereotype.Service;

import lormi.meipin.dto.WorkedAddDto;
import lormi.meipin.dto.WorkedEditDto;
import lormi.meipin.entity.Worked;
import lormi.meipin.exception.LMException;
import lormi.meipin.service.BaseService;
import lormi.meipin.service.IWorkedService;

@Service
public class WorkedService extends BaseService implements IWorkedService{

	@Override
	public void addWorked(WorkedAddDto workedAddDto) throws LMException {
		if (workedMapper.insert(new Worked(workedAddDto))<1) {
			throw new LMException(100035);
		}
	}

	@Override
	public void delWorked(Integer id) throws LMException {
		if (workedMapper.deleteByPrimaryKey(id)<1) {
			throw new LMException(100026);
		}
	}

	@Override
	public void editWorked(WorkedEditDto workedEditDto) throws LMException {
		if (workedMapper.updateByPrimaryKey(new Worked(workedEditDto))<1) {
			throw new LMException(100036);
		}
	}

	@Override
	public Worked getWorked(Integer id) {
		return workedMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<Worked> getList(Integer userid) throws LMException {
		return workedMapper.selectList(userid);
	}

	
	
}
